from dataclasses import dataclass

from src.application.server.dto import ServerDTO
from src.application.server.uow import ServerUoW
from src.application.user import dto
from src.application.user.converters import convert_active_user_entity_to_dto
from src.application.user.uow import UserUoW
from src.domain.user.value_objects import TelegramUserId


@dataclass(frozen=True)
class GetServerById:
    server_id: int


class GetServerByIdHandler:
    def __init__(self, *, uow: ServerUoW) -> None:
        self._uow = uow

    async def __call__(self, command: GetServerById) -> ServerDTO:
        server = await self._uow.server_reader.get_server_by_id(command.server_id)

        return server
